<%@ page language="java"  pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="p"%>
<%String path=request.getContextPath(); %>
<script>

function menu_selimg(){
	var str=ctx+"/platform/upload/UploadPage.page?type=icon&rootPath=/uploadfile/admin/menu/&fileName="+$getByName("bean.photo",$w.currWinForm()).val();
	$w.openDialog({url:str,title:"选择菜单图标",w:520,h:390,afterClose:function(re){
		if(re){
			$getByName("bean.photo",$w.currWinForm()).val(re);
		}
	}});
}
function menu_changetype(){
	var obj=document.getElementsByName("bean.openType")[0];
	if(obj.value=='javascript' || obj.value=='afterjavascript'){
		$("#menu_jsinput").show();
	}else{
		$("#menu_jsinput").hide();
	}
}
</script>

	<div class="easyui-panel" data-options="doSize:false,layoutH:47,border:false" style="margin:5px">
		<form method="post" action="/platform/menu/MenuPage.page">
			<p:hidden bind="bean.id"/>
    		<p:hidden bind="parMenuId"/>
			<p:hidden bind="actions"/>
			<div class="ui-formContent">
				<p>
					<label style="width:70px;text-align:right">菜单名称：</label>
					<p:text bind="bean.name" style="width:300px" styleClass="required"/>
				</p>
				<p>
					<label style="width:70px;text-align:right">Url：</label>
					<p:text bind="bean.url" style="width:300px"/>
				</p>
				<p>
					<label style="width:70px;text-align:right">菜单图标：</label>
					<p:text bind="bean.photo" style="width:288px" readonly="true"/>
					<span><a href="#" onclick="menu_selimg()"><img src="<%=path %>/platform/images/picture_add.png"></a></span>
				</p>
				<p style="float:left;width:100%">
					<label style="width:70px;text-align:right">是否刷新：</label>
					<p:checkbox bind="bean.isRefresh" value="1" text="是"/>
					<span class="inputInfo">(每次点击菜单是否刷新菜单内容)</span>
				</p>
				<p style="float:left;width:100%">
					<label style="width:70px;text-align:right">是否启用：</label>
					<p:radio bind="bean.state" value="1" text="是"/><p:radio bind="bean.state" value="0" text="否"/>
					
				</p>
				<p style="width:100%">
					<label style="width:70px;text-align:right">加载方式：</label>
					<select name="bean.openType" onchange="menu_changetype()">
					<p:options bind="bean.openType" collection="openTypeList" value="value" text="text"/>
					</select>
				</p>
				<p style="width:100%" id="menu_jsinput">
					<label style="width:70px;text-align:right">JavaScript：</label>
					<p:textarea bind="bean.javaScript" style="width:300px;height:60px"/>
				</p>
			</div>
			
		</form>
</div>
<div class="ui-buttonBar">
	<a href="#" class="easyui-linkbutton" iconCls="icon_save" 
	onclick="$w.doWinForm(function(re){
		if(re.state=='ok'){
			$w.correctMsg('添加成功！');
			$getByName('bean.name',$w.currWinForm()).val('');
			$getByName('bean.url',$w.currWinForm()).val('');
			$w.closeCurrWin('ok');
		}else if(re.state=='update'){
			$w.closeCurrWin($getByName('bean.name',$w.currWinForm()).val());
		}else if(re.state=='exist'){
			$w.alertMsg('存在相同的url！');
		}
	})">保 存</a>
	<a href="#" class="easyui-linkbutton" iconCls="icon_cancel" onclick="$w.closeCurrWin()">取 消</a>
</div>
<script>
menu_changetype();
</script>